@rien7/seji 0.0.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/design-surface.mjs +6 -0
- package/bin/postinstall.mjs +19 -0
- package/bin/seji.mjs +585 -0
- package/dist/agent/host.d.mts +34 -0
- package/dist/agent/host.mjs +387 -0
- package/dist/agent/messages.d.mts +9 -0
- package/dist/agent/messages.mjs +70 -0
- package/dist/agent/runtimes.mjs +157 -0
- package/dist/cli/app.mjs +321 -0
- package/dist/cli/appScan.mjs +284 -0
- package/dist/cli/catalog.mjs +78 -0
- package/dist/cli/component.mjs +165 -0
- package/dist/cli/consolidate.mjs +159 -0
- package/dist/cli/cssImport.mjs +68 -0
- package/dist/cli/dev.mjs +339 -0
- package/dist/cli/doctor.mjs +311 -0
- package/dist/cli/init.mjs +338 -0
- package/dist/cli/legacyNames.mjs +266 -0
- package/dist/cli/migrate.mjs +163 -0
- package/dist/cli/prompt.mjs +34 -0
- package/dist/cli/propose.mjs +208 -0
- package/dist/cli/providers.mjs +344 -0
- package/dist/cli/reviewOps.mjs +110 -0
- package/dist/cli/semver.mjs +45 -0
- package/dist/cli/setup.mjs +360 -0
- package/dist/cli/sketches.mjs +47 -0
- package/dist/cli/skills.mjs +150 -0
- package/dist/cli/snapshot.mjs +107 -0
- package/dist/cli/tokenOps.mjs +120 -0
- package/dist/cli/types.mjs +191 -0
- package/dist/cli/updater.mjs +274 -0
- package/dist/components/astIndex.mjs +992 -0
- package/dist/components/ops.mjs +1069 -0
- package/dist/editor/AgentProposalCard.d.ts +10 -0
- package/dist/editor/AgentProposalCard.d.ts.map +1 -0
- package/dist/editor/AgentProposalCard.js +31 -0
- package/dist/editor/AgentProposalCard.js.map +1 -0
- package/dist/editor/App.d.ts +2 -0
- package/dist/editor/App.d.ts.map +1 -0
- package/dist/editor/App.js +2834 -0
- package/dist/editor/App.js.map +1 -0
- package/dist/editor/CanvasHud.d.ts +12 -0
- package/dist/editor/CanvasHud.d.ts.map +1 -0
- package/dist/editor/CanvasHud.js +13 -0
- package/dist/editor/CanvasHud.js.map +1 -0
- package/dist/editor/CanvasSurface.d.ts +31 -0
- package/dist/editor/CanvasSurface.d.ts.map +1 -0
- package/dist/editor/CanvasSurface.js +270 -0
- package/dist/editor/CanvasSurface.js.map +1 -0
- package/dist/editor/CommentPopover.d.ts +17 -0
- package/dist/editor/CommentPopover.d.ts.map +1 -0
- package/dist/editor/CommentPopover.js +62 -0
- package/dist/editor/CommentPopover.js.map +1 -0
- package/dist/editor/Comments.d.ts +13 -0
- package/dist/editor/Comments.d.ts.map +1 -0
- package/dist/editor/Comments.js +41 -0
- package/dist/editor/Comments.js.map +1 -0
- package/dist/editor/ComponentPage.d.ts +28 -0
- package/dist/editor/ComponentPage.d.ts.map +1 -0
- package/dist/editor/ComponentPage.js +55 -0
- package/dist/editor/ComponentPage.js.map +1 -0
- package/dist/editor/ComponentPanel.d.ts +38 -0
- package/dist/editor/ComponentPanel.d.ts.map +1 -0
- package/dist/editor/ComponentPanel.js +275 -0
- package/dist/editor/ComponentPanel.js.map +1 -0
- package/dist/editor/Glyph.d.ts +51 -0
- package/dist/editor/Glyph.d.ts.map +1 -0
- package/dist/editor/Glyph.js +50 -0
- package/dist/editor/Glyph.js.map +1 -0
- package/dist/editor/History.d.ts +7 -0
- package/dist/editor/History.d.ts.map +1 -0
- package/dist/editor/History.js +51 -0
- package/dist/editor/History.js.map +1 -0
- package/dist/editor/Inspector.d.ts +56 -0
- package/dist/editor/Inspector.d.ts.map +1 -0
- package/dist/editor/Inspector.js +510 -0
- package/dist/editor/Inspector.js.map +1 -0
- package/dist/editor/LazyMount.d.ts +10 -0
- package/dist/editor/LazyMount.d.ts.map +1 -0
- package/dist/editor/LazyMount.js +29 -0
- package/dist/editor/LazyMount.js.map +1 -0
- package/dist/editor/LocaleSwitch.d.ts +3 -0
- package/dist/editor/LocaleSwitch.d.ts.map +1 -0
- package/dist/editor/LocaleSwitch.js +9 -0
- package/dist/editor/LocaleSwitch.js.map +1 -0
- package/dist/editor/PreviewFrame.d.ts +10 -0
- package/dist/editor/PreviewFrame.d.ts.map +1 -0
- package/dist/editor/PreviewFrame.js +22 -0
- package/dist/editor/PreviewFrame.js.map +1 -0
- package/dist/editor/ProjectIndex.d.ts +12 -0
- package/dist/editor/ProjectIndex.d.ts.map +1 -0
- package/dist/editor/ProjectIndex.js +43 -0
- package/dist/editor/ProjectIndex.js.map +1 -0
- package/dist/editor/PromoteComponent.d.ts +28 -0
- package/dist/editor/PromoteComponent.d.ts.map +1 -0
- package/dist/editor/PromoteComponent.js +33 -0
- package/dist/editor/PromoteComponent.js.map +1 -0
- package/dist/editor/PromoteForm.d.ts +18 -0
- package/dist/editor/PromoteForm.d.ts.map +1 -0
- package/dist/editor/PromoteForm.js +35 -0
- package/dist/editor/PromoteForm.js.map +1 -0
- package/dist/editor/PromoteToken.d.ts +31 -0
- package/dist/editor/PromoteToken.d.ts.map +1 -0
- package/dist/editor/PromoteToken.js +94 -0
- package/dist/editor/PromoteToken.js.map +1 -0
- package/dist/editor/StatePreviews.d.ts +28 -0
- package/dist/editor/StatePreviews.d.ts.map +1 -0
- package/dist/editor/StatePreviews.js +113 -0
- package/dist/editor/StatePreviews.js.map +1 -0
- package/dist/editor/ValueCombo.d.ts +51 -0
- package/dist/editor/ValueCombo.d.ts.map +1 -0
- package/dist/editor/ValueCombo.js +260 -0
- package/dist/editor/ValueCombo.js.map +1 -0
- package/dist/editor/agent/AgentPanel.d.ts +19 -0
- package/dist/editor/agent/AgentPanel.d.ts.map +1 -0
- package/dist/editor/agent/AgentPanel.js +271 -0
- package/dist/editor/agent/AgentPanel.js.map +1 -0
- package/dist/editor/agent/Markdown.d.ts +5 -0
- package/dist/editor/agent/Markdown.d.ts.map +1 -0
- package/dist/editor/agent/Markdown.js +28 -0
- package/dist/editor/agent/Markdown.js.map +1 -0
- package/dist/editor/agent/agentApi.d.ts +106 -0
- package/dist/editor/agent/agentApi.d.ts.map +1 -0
- package/dist/editor/agent/agentApi.js +66 -0
- package/dist/editor/agent/agentApi.js.map +1 -0
- package/dist/editor/agent/toolLines.d.ts +38 -0
- package/dist/editor/agent/toolLines.d.ts.map +1 -0
- package/dist/editor/agent/toolLines.js +159 -0
- package/dist/editor/agent/toolLines.js.map +1 -0
- package/dist/editor/agent/useAgent.d.ts +15 -0
- package/dist/editor/agent/useAgent.d.ts.map +1 -0
- package/dist/editor/agent/useAgent.js +65 -0
- package/dist/editor/agent/useAgent.js.map +1 -0
- package/dist/editor/api.d.ts +378 -0
- package/dist/editor/api.d.ts.map +1 -0
- package/dist/editor/api.js +247 -0
- package/dist/editor/api.js.map +1 -0
- package/dist/editor/camera.d.ts +18 -0
- package/dist/editor/camera.d.ts.map +1 -0
- package/dist/editor/camera.js +40 -0
- package/dist/editor/camera.js.map +1 -0
- package/dist/editor/canvas.d.ts +25 -0
- package/dist/editor/canvas.d.ts.map +1 -0
- package/dist/editor/canvas.js +35 -0
- package/dist/editor/canvas.js.map +1 -0
- package/dist/editor/changes/ChangesPage.d.ts +25 -0
- package/dist/editor/changes/ChangesPage.d.ts.map +1 -0
- package/dist/editor/changes/ChangesPage.js +132 -0
- package/dist/editor/changes/ChangesPage.js.map +1 -0
- package/dist/editor/changes/changeModel.d.ts +25 -0
- package/dist/editor/changes/changeModel.d.ts.map +1 -0
- package/dist/editor/changes/changeModel.js +81 -0
- package/dist/editor/changes/changeModel.js.map +1 -0
- package/dist/editor/changes/changeState.d.mts +29 -0
- package/dist/editor/changes/changeState.mjs +187 -0
- package/dist/editor/chrome/EditorChrome.d.ts +49 -0
- package/dist/editor/chrome/EditorChrome.d.ts.map +1 -0
- package/dist/editor/chrome/EditorChrome.js +21 -0
- package/dist/editor/chrome/EditorChrome.js.map +1 -0
- package/dist/editor/drafts.d.ts +46 -0
- package/dist/editor/drafts.d.ts.map +1 -0
- package/dist/editor/drafts.js +38 -0
- package/dist/editor/drafts.js.map +1 -0
- package/dist/editor/i18n.d.ts +29 -0
- package/dist/editor/i18n.d.ts.map +1 -0
- package/dist/editor/i18n.js +2320 -0
- package/dist/editor/i18n.js.map +1 -0
- package/dist/editor/iconStroke.d.ts +6 -0
- package/dist/editor/iconStroke.d.ts.map +1 -0
- package/dist/editor/iconStroke.js +6 -0
- package/dist/editor/iconStroke.js.map +1 -0
- package/dist/editor/main.d.ts +2 -0
- package/dist/editor/main.d.ts.map +1 -0
- package/dist/editor/main.js +14 -0
- package/dist/editor/main.js.map +1 -0
- package/dist/editor/model.d.ts +16 -0
- package/dist/editor/model.d.ts.map +1 -0
- package/dist/editor/model.js +11 -0
- package/dist/editor/model.js.map +1 -0
- package/dist/editor/reasons.d.ts +44 -0
- package/dist/editor/reasons.d.ts.map +1 -0
- package/dist/editor/reasons.js +131 -0
- package/dist/editor/reasons.js.map +1 -0
- package/dist/editor/reviewLifecycle.d.ts +8 -0
- package/dist/editor/reviewLifecycle.d.ts.map +1 -0
- package/dist/editor/reviewLifecycle.js +21 -0
- package/dist/editor/reviewLifecycle.js.map +1 -0
- package/dist/editor/styles.css +8737 -0
- package/dist/editor/tokenMatch.d.ts +59 -0
- package/dist/editor/tokenMatch.d.ts.map +1 -0
- package/dist/editor/tokenMatch.js +198 -0
- package/dist/editor/tokenMatch.js.map +1 -0
- package/dist/editor/tokens/ConsolidatePage.d.ts +16 -0
- package/dist/editor/tokens/ConsolidatePage.d.ts.map +1 -0
- package/dist/editor/tokens/ConsolidatePage.js +244 -0
- package/dist/editor/tokens/ConsolidatePage.js.map +1 -0
- package/dist/editor/tokens/TokenActivity.d.ts +18 -0
- package/dist/editor/tokens/TokenActivity.d.ts.map +1 -0
- package/dist/editor/tokens/TokenActivity.js +18 -0
- package/dist/editor/tokens/TokenActivity.js.map +1 -0
- package/dist/editor/tokens/TokenDialogs.d.ts +26 -0
- package/dist/editor/tokens/TokenDialogs.d.ts.map +1 -0
- package/dist/editor/tokens/TokenDialogs.js +119 -0
- package/dist/editor/tokens/TokenDialogs.js.map +1 -0
- package/dist/editor/tokens/TokenList.d.ts +21 -0
- package/dist/editor/tokens/TokenList.d.ts.map +1 -0
- package/dist/editor/tokens/TokenList.js +98 -0
- package/dist/editor/tokens/TokenList.js.map +1 -0
- package/dist/editor/tokens/TokenPage.d.ts +25 -0
- package/dist/editor/tokens/TokenPage.d.ts.map +1 -0
- package/dist/editor/tokens/TokenPage.js +108 -0
- package/dist/editor/tokens/TokenPage.js.map +1 -0
- package/dist/editor/tokens/tokenModel.d.ts +35 -0
- package/dist/editor/tokens/tokenModel.d.ts.map +1 -0
- package/dist/editor/tokens/tokenModel.js +72 -0
- package/dist/editor/tokens/tokenModel.js.map +1 -0
- package/dist/editor/ui/Button.d.ts +3 -0
- package/dist/editor/ui/Button.d.ts.map +1 -0
- package/dist/editor/ui/Button.js +6 -0
- package/dist/editor/ui/Button.js.map +1 -0
- package/dist/editor/ui/CommentBox.d.ts +23 -0
- package/dist/editor/ui/CommentBox.d.ts.map +1 -0
- package/dist/editor/ui/CommentBox.js +41 -0
- package/dist/editor/ui/CommentBox.js.map +1 -0
- package/dist/editor/ui/Icon.d.ts +8 -0
- package/dist/editor/ui/Icon.d.ts.map +1 -0
- package/dist/editor/ui/Icon.js +6 -0
- package/dist/editor/ui/Icon.js.map +1 -0
- package/dist/editor/ui/IconButton.d.ts +11 -0
- package/dist/editor/ui/IconButton.d.ts.map +1 -0
- package/dist/editor/ui/IconButton.js +6 -0
- package/dist/editor/ui/IconButton.js.map +1 -0
- package/dist/editor/ui/NumberInput.d.ts +14 -0
- package/dist/editor/ui/NumberInput.d.ts.map +1 -0
- package/dist/editor/ui/NumberInput.js +6 -0
- package/dist/editor/ui/NumberInput.js.map +1 -0
- package/dist/editor/ui/PageLine.d.ts +14 -0
- package/dist/editor/ui/PageLine.d.ts.map +1 -0
- package/dist/editor/ui/PageLine.js +7 -0
- package/dist/editor/ui/PageLine.js.map +1 -0
- package/dist/editor/ui/SearchPicker.d.ts +41 -0
- package/dist/editor/ui/SearchPicker.d.ts.map +1 -0
- package/dist/editor/ui/SearchPicker.js +82 -0
- package/dist/editor/ui/SearchPicker.js.map +1 -0
- package/dist/editor/ui/Select.d.ts +19 -0
- package/dist/editor/ui/Select.d.ts.map +1 -0
- package/dist/editor/ui/Select.js +12 -0
- package/dist/editor/ui/Select.js.map +1 -0
- package/dist/editor/ui/TokenField.d.ts +14 -0
- package/dist/editor/ui/TokenField.d.ts.map +1 -0
- package/dist/editor/ui/TokenField.js +41 -0
- package/dist/editor/ui/TokenField.js.map +1 -0
- package/dist/editor/ui/TokenPicker.d.ts +31 -0
- package/dist/editor/ui/TokenPicker.d.ts.map +1 -0
- package/dist/editor/ui/TokenPicker.js +26 -0
- package/dist/editor/ui/TokenPicker.js.map +1 -0
- package/dist/editor/useBuildError.d.ts +7 -0
- package/dist/editor/useBuildError.d.ts.map +1 -0
- package/dist/editor/useBuildError.js +30 -0
- package/dist/editor/useBuildError.js.map +1 -0
- package/dist/editor/useLatestRequest.d.ts +22 -0
- package/dist/editor/useLatestRequest.d.ts.map +1 -0
- package/dist/editor/useLatestRequest.js +49 -0
- package/dist/editor/useLatestRequest.js.map +1 -0
- package/dist/editor-bundle/editor.css +2 -0
- package/dist/editor-bundle/editor.js +83 -0
- package/dist/editor-ui.d.ts +15 -0
- package/dist/editor-ui.d.ts.map +1 -0
- package/dist/editor-ui.js +14 -0
- package/dist/editor-ui.js.map +1 -0
- package/dist/inspector/runtime.d.ts +18 -0
- package/dist/inspector/runtime.d.ts.map +1 -0
- package/dist/inspector/runtime.js +1280 -0
- package/dist/inspector/runtime.js.map +1 -0
- package/dist/preview/main.d.ts +3 -0
- package/dist/preview/main.d.ts.map +1 -0
- package/dist/preview/main.js +320 -0
- package/dist/preview/main.js.map +1 -0
- package/dist/preview/preview.css +40 -0
- package/dist/runtime/index.d.ts +3 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +2 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/shared/buildError.d.mts +27 -0
- package/dist/shared/buildError.mjs +141 -0
- package/dist/shared/cameraFit.d.mts +16 -0
- package/dist/shared/cameraFit.mjs +47 -0
- package/dist/shared/canvasLayout.d.mts +13 -0
- package/dist/shared/canvasLayout.mjs +171 -0
- package/dist/shared/commentShots.d.mts +12 -0
- package/dist/shared/commentShots.mjs +53 -0
- package/dist/shared/componentExtract.d.mts +43 -0
- package/dist/shared/componentExtract.mjs +136 -0
- package/dist/shared/componentMeta.d.mts +26 -0
- package/dist/shared/componentMeta.mjs +87 -0
- package/dist/shared/componentOps.d.mts +70 -0
- package/dist/shared/componentOps.mjs +407 -0
- package/dist/shared/componentTarget.d.mts +15 -0
- package/dist/shared/componentTarget.mjs +58 -0
- package/dist/shared/components.d.mts +30 -0
- package/dist/shared/components.mjs +106 -0
- package/dist/shared/consolidateCategories.d.mts +2 -0
- package/dist/shared/consolidateCategories.mjs +6 -0
- package/dist/shared/env.d.mts +4 -0
- package/dist/shared/env.mjs +18 -0
- package/dist/shared/gitChanges.d.mts +2 -0
- package/dist/shared/gitChanges.mjs +30 -0
- package/dist/shared/legacyPaths.d.mts +1 -0
- package/dist/shared/legacyPaths.mjs +9 -0
- package/dist/shared/oklab.d.mts +6 -0
- package/dist/shared/oklab.mjs +56 -0
- package/dist/shared/optimizeEntries.d.mts +5 -0
- package/dist/shared/optimizeEntries.mjs +24 -0
- package/dist/shared/packages.d.mts +11 -0
- package/dist/shared/packages.mjs +96 -0
- package/dist/shared/projectFiles.d.mts +23 -0
- package/dist/shared/projectFiles.mjs +72 -0
- package/dist/shared/prompt.d.mts +25 -0
- package/dist/shared/prompt.mjs +217 -0
- package/dist/shared/proposals.d.mts +11 -0
- package/dist/shared/proposals.mjs +42 -0
- package/dist/shared/protocol.d.ts +122 -0
- package/dist/shared/protocol.d.ts.map +1 -0
- package/dist/shared/protocol.js +7 -0
- package/dist/shared/protocol.js.map +1 -0
- package/dist/shared/reviewArchive.d.mts +4 -0
- package/dist/shared/reviewArchive.mjs +19 -0
- package/dist/shared/reviewStore.d.mts +30 -0
- package/dist/shared/reviewStore.mjs +218 -0
- package/dist/shared/reviewVerify.d.mts +21 -0
- package/dist/shared/reviewVerify.mjs +158 -0
- package/dist/shared/sizeModes.d.mts +15 -0
- package/dist/shared/sizeModes.mjs +53 -0
- package/dist/shared/sketches.d.mts +10 -0
- package/dist/shared/sketches.mjs +64 -0
- package/dist/shared/snapshotCheck.d.mts +13 -0
- package/dist/shared/snapshotCheck.mjs +81 -0
- package/dist/shared/timeout.d.mts +1 -0
- package/dist/shared/timeout.mjs +15 -0
- package/dist/shared/tokens.d.ts +2 -0
- package/dist/shared/tokens.d.ts.map +1 -0
- package/dist/shared/tokens.js +2 -0
- package/dist/shared/tokens.js.map +1 -0
- package/dist/shared/types.d.ts +689 -0
- package/dist/shared/types.d.ts.map +1 -0
- package/dist/shared/types.js +13 -0
- package/dist/shared/types.js.map +1 -0
- package/dist/shared/wheelRouting.d.mts +9 -0
- package/dist/shared/wheelRouting.mjs +31 -0
- package/dist/shared/writeScope.mjs +96 -0
- package/dist/snapshots/diff.d.mts +28 -0
- package/dist/snapshots/diff.mjs +263 -0
- package/dist/snapshots/index.d.mts +110 -0
- package/dist/snapshots/index.mjs +638 -0
- package/dist/snapshots/render.d.mts +24 -0
- package/dist/snapshots/render.mjs +250 -0
- package/dist/snapshots/toolOps.d.mts +25 -0
- package/dist/snapshots/toolOps.mjs +69 -0
- package/dist/tokens/adapters/css.mjs +51 -0
- package/dist/tokens/adapters/cssInCode.mjs +314 -0
- package/dist/tokens/adapters/oxcShared.mjs +80 -0
- package/dist/tokens/adapters/preprocessor.mjs +63 -0
- package/dist/tokens/adapters/registry.mjs +53 -0
- package/dist/tokens/adapters/tailwindcss.mjs +424 -0
- package/dist/tokens/adapters/types.mjs +117 -0
- package/dist/tokens/consolidate/index.d.mts +42 -0
- package/dist/tokens/consolidate/index.mjs +111 -0
- package/dist/tokens/consolidate/normalize.mjs +479 -0
- package/dist/tokens/consolidate/plan.mjs +726 -0
- package/dist/tokens/consolidate/scan.mjs +928 -0
- package/dist/tokens/extract.mjs +441 -0
- package/dist/tokens/moduleData.d.mts +14 -0
- package/dist/tokens/moduleData.mjs +32 -0
- package/dist/tokens/opLock.d.mts +4 -0
- package/dist/tokens/opLock.mjs +108 -0
- package/dist/tokens/ops.d.mts +71 -0
- package/dist/tokens/ops.mjs +1511 -0
- package/dist/tokens/pipeline.mjs +813 -0
- package/dist/tokens/report.d.mts +47 -0
- package/dist/tokens/report.mjs +257 -0
- package/dist/tokens/rewrite/code.mjs +172 -0
- package/dist/tokens/rewrite/css.mjs +154 -0
- package/dist/tokens/rewrite/index.mjs +244 -0
- package/dist/tokens/rewrite/tailwind.mjs +288 -0
- package/dist/tokens/rewrite/text.mjs +116 -0
- package/dist/tokens/rewrite/value.mjs +115 -0
- package/dist/tokens/usage.d.mts +97 -0
- package/dist/tokens/usage.mjs +680 -0
- package/dist/vite/agent.d.ts +21 -0
- package/dist/vite/agent.d.ts.map +1 -0
- package/dist/vite/agent.js +165 -0
- package/dist/vite/agent.js.map +1 -0
- package/dist/vite/events.d.ts +27 -0
- package/dist/vite/events.d.ts.map +1 -0
- package/dist/vite/events.js +156 -0
- package/dist/vite/events.js.map +1 -0
- package/dist/vite/layout.d.ts +2 -0
- package/dist/vite/layout.d.ts.map +1 -0
- package/dist/vite/layout.js +4 -0
- package/dist/vite/layout.js.map +1 -0
- package/dist/vite/plugin.d.ts +40 -0
- package/dist/vite/plugin.d.ts.map +1 -0
- package/dist/vite/plugin.js +1264 -0
- package/dist/vite/plugin.js.map +1 -0
- package/dist/vite/requestGuard.d.mts +3 -0
- package/dist/vite/requestGuard.mjs +43 -0
- package/dist/vite/review.d.ts +11 -0
- package/dist/vite/review.d.ts.map +1 -0
- package/dist/vite/review.js +283 -0
- package/dist/vite/review.js.map +1 -0
- package/package.json +106 -1
- package/skills/seji/SKILL.md +400 -0
- package/skills/seji-authoring/SKILL.md +397 -0
- package/skills/seji-tokens/SKILL.md +432 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Best effort: after a global install, write the skills to the agents' global skill directories
|
|
3
|
+
// (same as `seji skills install`). Never fails the install, and does nothing for
|
|
4
|
+
// project-level installs or a source checkout. Package managers that skip install scripts
|
|
5
|
+
// (pnpm, bun by default) need `seji skills install` once.
|
|
6
|
+
import fs from 'node:fs'
|
|
7
|
+
|
|
8
|
+
try {
|
|
9
|
+
const base = fs.existsSync(new URL('../dist/cli/skills.mjs', import.meta.url)) ? '../dist' : '../src'
|
|
10
|
+
const { detectInstall } = await import(`${base}/cli/updater.mjs`)
|
|
11
|
+
const globalFlag = process.env.npm_config_global === 'true' || process.env.npm_config_location === 'global'
|
|
12
|
+
if (globalFlag || detectInstall().global) {
|
|
13
|
+
const { installSkills } = await import(`${base}/cli/skills.mjs`)
|
|
14
|
+
const targets = installSkills()
|
|
15
|
+
console.log(`seji: skills installed in ${targets.map((target) => target.dir).join(', ')}`)
|
|
16
|
+
}
|
|
17
|
+
} catch (error) {
|
|
18
|
+
console.log(`seji: skills not installed (${error instanceof Error ? error.message : String(error)}); run seji skills install`)
|
|
19
|
+
}
|
package/bin/seji.mjs
ADDED
|
@@ -0,0 +1,585 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import fs from 'node:fs'
|
|
3
|
+
import path from 'node:path'
|
|
4
|
+
import process from 'node:process'
|
|
5
|
+
|
|
6
|
+
const runtimeBase = fs.existsSync(new URL('../dist/cli/init.mjs', import.meta.url))
|
|
7
|
+
? '../dist'
|
|
8
|
+
: '../src'
|
|
9
|
+
|
|
10
|
+
const loadModule = (relPath) => import(`${runtimeBase}/${relPath}`)
|
|
11
|
+
|
|
12
|
+
const root = process.cwd()
|
|
13
|
+
const designRoot = path.join(root, 'design')
|
|
14
|
+
|
|
15
|
+
const usage = `seji — inspect the design review ledger, tokens, and project setup
|
|
16
|
+
|
|
17
|
+
Install once, globally, with npm (not a pnpm / yarn / bun global): npm i -g @rien7/seji@latest,
|
|
18
|
+
then run seji setup in the app. The first command writes the global skills when they are
|
|
19
|
+
missing or outdated. Every run checks npm for a newer release (cached for an hour, a failed check for
|
|
20
|
+
10 minutes, 1.5 s timeout, offline → skip), installs it globally with npm and re-runs the command on
|
|
21
|
+
it. SEJI_NO_UPDATE=1 turns that off. The project gets no dependency: package.json and the
|
|
22
|
+
lockfile are never touched.
|
|
23
|
+
|
|
24
|
+
Usage:
|
|
25
|
+
seji skills install [--dir <skills-dir>]... [--json]
|
|
26
|
+
seji --version | -v | version
|
|
27
|
+
seji setup [--app <dir>] [--dry-run] [--css-format theme|root] [--no-doctor] [--json] (alias: init)
|
|
28
|
+
seji doctor [--app <dir>] [--deep] [--json]
|
|
29
|
+
seji dev [--app <dir>] [--port <port>] [--host [host]] [--open] [--config <vite-config>]
|
|
30
|
+
seji tokens build
|
|
31
|
+
seji tokens check
|
|
32
|
+
seji tokens extract [files...] [--dry-run]
|
|
33
|
+
seji tokens rename <token> --to <new.path> [--no-alias] [--reason <text>]
|
|
34
|
+
seji tokens merge <token> --into <token> [--keep target|source] [--no-alias] [--reason <text>]
|
|
35
|
+
seji tokens deprecate <token> (--replacement <token> | --no-replacement --reason <text>) [--mode mark-only|replace-all]
|
|
36
|
+
seji tokens delete <token>
|
|
37
|
+
seji tokens describe <token> --description <text>
|
|
38
|
+
seji tokens set <token> --value <value|{alias.path}>
|
|
39
|
+
seji tokens create <dot.path> --value <value|{alias.path}> --tier primitive|semantic|component --description <text> [--type <dtcg type>]
|
|
40
|
+
seji tokens replace-literal <literal> --token <token> [--scope <file|dir>] [--property <prop>]
|
|
41
|
+
seji tokens revert <batch> [--force]
|
|
42
|
+
seji consolidate scan [--scope <glob|dir>]... [--category <category>]... [--tolerance <n>] [--root-px <px>] [--json]
|
|
43
|
+
seji consolidate plan [scan options] [--design <id>] [--json]
|
|
44
|
+
seji consolidate list
|
|
45
|
+
seji consolidate show <plan> [--json]
|
|
46
|
+
seji consolidate set <plan> <row> --action reuse|create|merge|skip [--token <token>] [--name <dot.path>] [--tier <tier>] [--description <text>] [--value <value>] [--merge <token,…>] [--accept-visible-change|--reject-visible-change]
|
|
47
|
+
seji consolidate apply <plan> [--dry-run] [--design <id>] [--snapshots]
|
|
48
|
+
seji consolidate revert <plan> [--force] [--dry-run]
|
|
49
|
+
seji consolidate discard <plan>
|
|
50
|
+
seji propose token <design> --name <--token> [--value <val>] [--tier <tier>] [--description <text>] [--alias <path>] [--type <type>] [--action <action>] [--replaces <literal>] [--rationale <text>]
|
|
51
|
+
seji propose component <Component> (--frames <id,id> | --frame <id>...) --rationale <text> [--reason <summary>] [--design <design>]
|
|
52
|
+
seji proposal <design> <id> approve|reject|reset [--note <text>] [--value <value>]
|
|
53
|
+
seji component list
|
|
54
|
+
seji component show <Component>
|
|
55
|
+
seji component describe <Component> "<usage note>"
|
|
56
|
+
seji component rename <Component> --to <NewName> [--reason <text>] [--design <design>] [--dry-run]
|
|
57
|
+
seji component merge <Component> --into <Component> [--reason <text>] [--design <design>] [--dry-run]
|
|
58
|
+
seji component deprecate <Component> (--replacement <Component> | --no-replacement) --reason <text> [--replace-all [--dry-run]] [--design <design>]
|
|
59
|
+
seji component undeprecate <Component>
|
|
60
|
+
seji component delete <Component> [--reason <text>] [--design <design>]
|
|
61
|
+
seji component tidy <Component> (--frames <id,id> | --frame <id>...) [--reason <text>] [--design <design>]
|
|
62
|
+
seji component revert <batch> [--design <design>] [--force] [--dry-run]
|
|
63
|
+
seji usage [<token>]
|
|
64
|
+
seji usage --hardcoded [<file|dir|Component>]
|
|
65
|
+
seji health
|
|
66
|
+
seji verify [<design>...] [--item <id>]... [--snapshots] [--url <dev-url>] [--config <vite-config>] [--dry-run]
|
|
67
|
+
seji snapshot capture <design> [<itemId>...] [--force] [--url <dev-url>] [--config <vite-config>]
|
|
68
|
+
seji snapshot wait <design> [<itemId>...] [--timeout <seconds>]
|
|
69
|
+
seji snapshot compare <design> [<itemId>...] [--url <dev-url>] [--config <vite-config>]
|
|
70
|
+
seji snapshot show <design> <itemId>
|
|
71
|
+
seji snapshot accept <design> <itemId> [<frame>...]
|
|
72
|
+
seji snapshot reject <design> <itemId> [<frame>...] --reason "<why>"
|
|
73
|
+
seji status <design> <itemId> <in_progress|resolved> [--reply "<summary>"]
|
|
74
|
+
seji reply <design> <itemId> "<message>" [--resolve]
|
|
75
|
+
seji list
|
|
76
|
+
seji show <design>
|
|
77
|
+
seji prompt <design> (the editor's "Hand to agent" text)
|
|
78
|
+
seji check
|
|
79
|
+
seji clear <design>
|
|
80
|
+
|
|
81
|
+
Review ledgers live in design/<design>/review.json and are tracked. A ledger contains
|
|
82
|
+
design-scoped tokens, frame/component-scoped styles, free layout, suggestions and comments.
|
|
83
|
+
Agents update item status/replies in place. Resolved non-token items are archived after
|
|
84
|
+
10 minutes; token items are archived only after verification writes verifiedAt (the canvas
|
|
85
|
+
or \`verify\`) and 10 minutes pass. Items with a snapshot baseline are archived only once
|
|
86
|
+
their snapshot check passes (compared, every change accepted, nothing missing or failed).
|
|
87
|
+
|
|
88
|
+
usage, health and verify run headless (no canvas needed) and print JSON:
|
|
89
|
+
usage every token with its referencing token / component / screen / code-ref counts
|
|
90
|
+
usage <token> one token (--css-name or dot.path): referencing tokens, components, screens, code refs
|
|
91
|
+
usage --hardcoded [scope] hard-coded color literals with exact-value token matches
|
|
92
|
+
health token validation, contrast, duplicates/orphans/tier issues, verification status
|
|
93
|
+
verify run the three checks (token values, references, snapshots) on resolved
|
|
94
|
+
items, store them as item.checks and write verifiedAt when values and
|
|
95
|
+
references pass; --snapshots renders "after" and diffs it first;
|
|
96
|
+
--item checks given non-archived items of one design in any status
|
|
97
|
+
snapshot capture "before" baselines, compare, show, accept or reject (with a
|
|
98
|
+
reason that reopens the item for the agent). \`snapshot wait\` blocks until
|
|
99
|
+
a running baseline capture (e.g. the dev server's) finishes; run it before
|
|
100
|
+
editing source. Needs Playwright Chromium; starts a short-lived Vite server
|
|
101
|
+
unless --url points at a running one.
|
|
102
|
+
Images: design/.seji/snapshots/<design>/<item>/{before,after,diff}/<frame>-<hash>.png
|
|
103
|
+
|
|
104
|
+
component pages (headless, same as /__seji/api/components and the editor; the component
|
|
105
|
+
set is the seji plugin's componentGroups from vite.config.*, else design/surface.config.json;
|
|
106
|
+
--config <file> picks a Vite config):
|
|
107
|
+
component list every component: layer, status, tokens, primitive / hard-coded, uses (JSON)
|
|
108
|
+
component show <C> usage note, tokens/literals its styles use, pending items (JSON).
|
|
109
|
+
Uses come from the syntax tree: renders, aliased / namespaced imports,
|
|
110
|
+
as={C}, createElement(C), lazy(() => import()), barrel re-exports.
|
|
111
|
+
component describe write the component's $description to design/components.json
|
|
112
|
+
rename | merge | deprecate --replace-all
|
|
113
|
+
executed by the tool with the syntax tree: export, imports (aliases keep
|
|
114
|
+
their local name), JSX, references, the file named after it, its
|
|
115
|
+
design/components.ts / components.json entries. One revertible batch +
|
|
116
|
+
one review item listing what it changed and what it left for the agent.
|
|
117
|
+
--dry-run lists every place and writes nothing.
|
|
118
|
+
deprecate (mark) / undeprecate
|
|
119
|
+
write / clear $deprecated + replacement in design/components.json.
|
|
120
|
+
delete | tidy a review item for the agent (delete: it checks the uses first).
|
|
121
|
+
revert <batch> undo a tool batch (files, file moves, metadata).
|
|
122
|
+
proposal decides an agent proposal (same as the editor's proposal cards).
|
|
123
|
+
|
|
124
|
+
Token operations (rename / merge / deprecate / delete / describe / set / create / replace-literal)
|
|
125
|
+
are executed by the tool: it edits the DTCG source, rewrites every static reference the
|
|
126
|
+
parsers locate (var(--x) in CSS/SCSS/Less/CSS Modules, style={{}} / StyleX strings, Tailwind
|
|
127
|
+
classes), rebuilds tokens, and records one review item + batch (--design <id>, or the only
|
|
128
|
+
design) saying how many places it changed and which it left for the agent (file:line,
|
|
129
|
+
reason). All take --dry-run (lists every place, writes nothing) and print JSON;
|
|
130
|
+
\`tokens revert <batch>\` restores the files of a batch. --snapshots renders the screens the
|
|
131
|
+
change affects right before the write and compares them after the rebuild (needs Playwright;
|
|
132
|
+
the result's "snapshots" says how many frames changed — accept or reject them per frame).
|
|
133
|
+
Token operations, consolidate apply and component operations share one write scope: files
|
|
134
|
+
inside the project root, plus directories listed in writableDirs (design/tokens.config.json).
|
|
135
|
+
|
|
136
|
+
consolidate (整合已有样式) scans a scope for hard-coded values and tokens in use per category
|
|
137
|
+
(color, spacing, radius, font-size, font-weight, line-height, border-width, shadow; size is
|
|
138
|
+
opt-in), clusters near-identical values (colors by OKLab ΔE within one hue family: a tint never
|
|
139
|
+
joins a gray; dimensions in px) and suggests per row: reuse a token, create one (name, tier and
|
|
140
|
+
description come from the agent / user), or merge duplicates. A row whose suggestion would change
|
|
141
|
+
rendering is marked with the delta and left undecided: pick its --action, then
|
|
142
|
+
--accept-visible-change; apply refuses undecided rows. \`plan\` saves the scan to design/.seji/consolidate/<plan>.json; \`apply\` runs
|
|
143
|
+
it as one tool operation (one review item + one revertible batch; --snapshots compares the
|
|
144
|
+
affected screens like token operations); \`discard\` deletes a draft or reverted plan.
|
|
145
|
+
`
|
|
146
|
+
|
|
147
|
+
const fail = (message) => {
|
|
148
|
+
console.error(`seji: ${message}`)
|
|
149
|
+
process.exit(1)
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const readJson = (file) => {
|
|
153
|
+
try {
|
|
154
|
+
return JSON.parse(fs.readFileSync(file, 'utf8'))
|
|
155
|
+
} catch {
|
|
156
|
+
return null
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const reviewFiles = () => {
|
|
161
|
+
if (!fs.existsSync(designRoot)) return []
|
|
162
|
+
const files = []
|
|
163
|
+
for (const entry of fs.readdirSync(designRoot, { withFileTypes: true })) {
|
|
164
|
+
if (!entry.isDirectory()) continue
|
|
165
|
+
const file = path.join(designRoot, entry.name, 'review.json')
|
|
166
|
+
if (fs.existsSync(file)) files.push({ design: entry.name, file })
|
|
167
|
+
}
|
|
168
|
+
return files.sort((a, b) => a.design.localeCompare(b.design))
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const pending = (items) => (items ?? []).filter((item) => item.status !== 'archived')
|
|
172
|
+
const countBy = (items, status) =>
|
|
173
|
+
(items ?? []).filter((item) => item.status === status).length
|
|
174
|
+
|
|
175
|
+
const command = process.argv[2]
|
|
176
|
+
const arg = process.argv[3]
|
|
177
|
+
|
|
178
|
+
// `seji <command> [<sub>] --help | -h`: that command's lines of the usage, exit 0 (before the
|
|
179
|
+
// updater and before any option parsing, which would reject the flag).
|
|
180
|
+
if (command && !command.startsWith('-') && command !== 'help' && process.argv.slice(3).some((token) => token === '--help' || token === '-h')) {
|
|
181
|
+
const name = command === 'init' ? 'setup' : command
|
|
182
|
+
const lines = usage.split('\n').filter((line) => line.startsWith(` seji ${name} `) || line === ` seji ${name}`)
|
|
183
|
+
const sub = arg && !arg.startsWith('-') ? lines.filter((line) => line.startsWith(` seji ${name} ${arg} `) || line === ` seji ${name} ${arg}`) : []
|
|
184
|
+
if (lines.length) {
|
|
185
|
+
console.log(`Usage:\n${(sub.length ? sub : lines).join('\n')}\n\nseji --help lists every command.`)
|
|
186
|
+
process.exit(0)
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
{
|
|
191
|
+
// Always latest: one owner (cli/updater.mjs). When it re-ran the command on a newer version,
|
|
192
|
+
// that run's exit code is ours.
|
|
193
|
+
const { runUpdater } = await loadModule('cli/updater.mjs')
|
|
194
|
+
const update = await runUpdater({ argv: process.argv.slice(2) })
|
|
195
|
+
if (update.exitCode !== undefined) process.exit(update.exitCode)
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
if (command === 'skills') {
|
|
199
|
+
if (arg !== 'install') fail('usage: seji skills install [--dir <skills-dir>]... [--json]')
|
|
200
|
+
const rest = process.argv.slice(4)
|
|
201
|
+
const dirs = []
|
|
202
|
+
let asJson = false
|
|
203
|
+
for (let i = 0; i < rest.length; i += 1) {
|
|
204
|
+
if (rest[i] === '--json') asJson = true
|
|
205
|
+
else if (rest[i] === '--dir') {
|
|
206
|
+
if (!rest[i + 1]) fail('--dir requires a directory')
|
|
207
|
+
dirs.push(path.resolve(root, rest[i + 1]))
|
|
208
|
+
i += 1
|
|
209
|
+
} else if (rest[i].startsWith('--dir=')) dirs.push(path.resolve(root, rest[i].slice('--dir='.length)))
|
|
210
|
+
else fail(`unknown skills option: ${rest[i]}`)
|
|
211
|
+
}
|
|
212
|
+
const { installSkills } = await loadModule('cli/skills.mjs')
|
|
213
|
+
const targets = installSkills({ dirs })
|
|
214
|
+
if (asJson) {
|
|
215
|
+
console.log(JSON.stringify({ ok: true, targets }, null, 2))
|
|
216
|
+
process.exit(0)
|
|
217
|
+
}
|
|
218
|
+
const LABELS = { created: 'CREATE ', updated: 'UPDATE ', unchanged: 'UNCHANGED', removed: 'REMOVE ' }
|
|
219
|
+
for (const target of targets) {
|
|
220
|
+
for (const item of target.results) if (item.status !== 'unchanged') console.log(`${LABELS[item.status]} ${item.file}`)
|
|
221
|
+
console.log(`${target.changed ? 'SKILLS ' : 'CURRENT '} ${target.dir} (${target.agent})`)
|
|
222
|
+
}
|
|
223
|
+
process.exit(0)
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
if (command === '--version' || command === '-v' || command === 'version') {
|
|
227
|
+
const { CURRENT_VERSION, detectInstall } = await loadModule('cli/updater.mjs')
|
|
228
|
+
const where = detectInstall()
|
|
229
|
+
console.log(command === 'version' ? `${CURRENT_VERSION} (${where.global ? `${where.pm}-global` : where.kind})` : CURRENT_VERSION)
|
|
230
|
+
process.exit(0)
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
if (!command || command === 'help' || command === '--help' || command === '-h') {
|
|
234
|
+
console.log(usage)
|
|
235
|
+
process.exit(0)
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// 0.5.x left the tool cache in design/.design-surface/: renamed to design/.seji/ before any
|
|
239
|
+
// command reads or writes it (setup and dev do the same for the app they find).
|
|
240
|
+
if (!['setup', 'init', 'dev', 'doctor'].includes(command) && fs.existsSync(path.join(designRoot, '.design-surface'))) {
|
|
241
|
+
try {
|
|
242
|
+
const { formatCacheMigration, migrateCacheDir } = await loadModule('cli/legacyNames.mjs')
|
|
243
|
+
for (const line of formatCacheMigration(migrateCacheDir(root))) console.error(line)
|
|
244
|
+
} catch (error) {
|
|
245
|
+
console.error(`seji: design/.design-surface/ not renamed (${error instanceof Error ? error.message : String(error)}); run seji setup`)
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
if (command === 'setup' || command === 'init') {
|
|
250
|
+
// `init` is the 0.4.2 name. Non-interactive and repeatable; installs nothing.
|
|
251
|
+
try {
|
|
252
|
+
const { parseSetupArgs, runSetup, formatSetup } = await loadModule('cli/setup.mjs')
|
|
253
|
+
const { formatDoctor } = await loadModule('cli/doctor.mjs')
|
|
254
|
+
const options = parseSetupArgs(process.argv.slice(3))
|
|
255
|
+
const report = await runSetup({ cwd: root, app: options.app, dryRun: options.dryRun, cssFormat: options.cssFormat, deep: options.deep })
|
|
256
|
+
if (options.json) console.log(JSON.stringify(report, null, 2))
|
|
257
|
+
else if (report.exitCode === 2) console.error(`seji: ${report.message}`)
|
|
258
|
+
else console.log(formatSetup(report, { formatDoctor }))
|
|
259
|
+
process.exit(report.exitCode)
|
|
260
|
+
} catch (error) {
|
|
261
|
+
fail(error instanceof Error ? error.message : String(error))
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
if (command === 'doctor') {
|
|
266
|
+
const rest = process.argv.slice(3)
|
|
267
|
+
let app
|
|
268
|
+
for (let i = 0; i < rest.length; i += 1) {
|
|
269
|
+
if (rest[i] === '--app') {
|
|
270
|
+
app = rest[i + 1]
|
|
271
|
+
i += 1
|
|
272
|
+
} else if (rest[i].startsWith('--app=')) app = rest[i].slice('--app='.length)
|
|
273
|
+
else if (rest[i] !== '--json' && rest[i] !== '--deep') fail(`unknown doctor option: ${rest[i]}`)
|
|
274
|
+
}
|
|
275
|
+
const { runDoctor, formatDoctor } = await loadModule('cli/doctor.mjs')
|
|
276
|
+
const report = await runDoctor({ root, app, deep: rest.includes('--deep') })
|
|
277
|
+
console.log(rest.includes('--json') ? JSON.stringify(report, null, 2) : formatDoctor(report))
|
|
278
|
+
process.exit(report.ok ? 0 : 1)
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
if (command === 'dev') {
|
|
282
|
+
const devArgs = process.argv.slice(3)
|
|
283
|
+
if (devArgs.includes('--help') || devArgs.includes('-h')) {
|
|
284
|
+
console.log(usage)
|
|
285
|
+
process.exit(0)
|
|
286
|
+
}
|
|
287
|
+
try {
|
|
288
|
+
const { startDevServer, parseDevArgs } = await loadModule('cli/dev.mjs')
|
|
289
|
+
parseDevArgs(devArgs)
|
|
290
|
+
await startDevServer({ root, argv: devArgs })
|
|
291
|
+
} catch (error) {
|
|
292
|
+
fail(error instanceof Error ? error.message : String(error))
|
|
293
|
+
}
|
|
294
|
+
} else {
|
|
295
|
+
|
|
296
|
+
if (command === 'tokens') {
|
|
297
|
+
const sub = arg
|
|
298
|
+
if (sub === 'build' || sub === 'check') {
|
|
299
|
+
try {
|
|
300
|
+
const { runTokenPipeline } = await loadModule('tokens/pipeline.mjs')
|
|
301
|
+
const check = sub === 'check'
|
|
302
|
+
const { counts, warnings, contrast, unsupported } = await runTokenPipeline({ root, check })
|
|
303
|
+
console.log(
|
|
304
|
+
`Tokens ${check ? 'OK' : 'built'}: ${counts.total} total · ${counts.byTier.primitive} primitive · ${counts.byTier.semantic} semantic · ${counts.byTier.component} component`,
|
|
305
|
+
)
|
|
306
|
+
for (const warning of warnings) console.warn(`Warning: ${warning}`)
|
|
307
|
+
for (const item of unsupported ?? []) {
|
|
308
|
+
console.log(
|
|
309
|
+
`Unsupported [${item.adapter}] ${item.file}${item.line ? `:${item.line}` : ''}: ${item.reason} (${item.count})`,
|
|
310
|
+
)
|
|
311
|
+
}
|
|
312
|
+
for (const item of contrast) {
|
|
313
|
+
console.log(`Contrast ${item.fg} on ${item.bg}: ${item.ratio}:1 ${item.pass ? 'PASS' : 'FAIL'}`)
|
|
314
|
+
}
|
|
315
|
+
process.exit(0)
|
|
316
|
+
} catch (error) {
|
|
317
|
+
fail(error instanceof Error ? error.message : String(error))
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
if (sub === 'extract') {
|
|
321
|
+
const rest = process.argv.slice(4)
|
|
322
|
+
const dryRun = rest.includes('--dry-run')
|
|
323
|
+
const files = rest.filter((item) => item !== '--dry-run')
|
|
324
|
+
try {
|
|
325
|
+
const { extractTokensFromCss } = await loadModule('tokens/extract.mjs')
|
|
326
|
+
const result = await extractTokensFromCss({ root, files, dryRun })
|
|
327
|
+
console.log(
|
|
328
|
+
`${dryRun ? '[dry-run] ' : ''}Scanned ${result.scannedFiles.length} CSS file(s): ${result.addedPrimitives.length} primitive, ${result.addedSemantics.length} semantic, ${result.skippedExisting.length} existing skipped`,
|
|
329
|
+
)
|
|
330
|
+
if (result.addedPrimitives.length) {
|
|
331
|
+
console.log(`Primitive (${result.primitiveFile}):`)
|
|
332
|
+
for (const item of result.addedPrimitives) {
|
|
333
|
+
console.log(` + ${item.path} (${item.cssName}): ${JSON.stringify(item.value)} [${item.type}]`)
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
if (result.addedSemantics.length) {
|
|
337
|
+
console.log(`Semantic (${result.semanticFile}):`)
|
|
338
|
+
for (const item of result.addedSemantics) {
|
|
339
|
+
console.log(` + ${item.path} (${item.cssName}): ${item.value} [${item.type}]`)
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
for (const item of result.renamed ?? []) console.log(`Renamed ${item.cssName}: ${item.from} → ${item.to} (collides with another token; the CSS name stays)`)
|
|
343
|
+
if (result.dark?.length) console.log(`Dark values recorded ($extensions["design-surface"].modes.dark): ${result.dark.join(', ')}`)
|
|
344
|
+
if (!dryRun && (result.addedPrimitives.length || result.addedSemantics.length)) {
|
|
345
|
+
console.log('Run `seji tokens build` to regenerate CSS and TS metadata.')
|
|
346
|
+
}
|
|
347
|
+
process.exit(0)
|
|
348
|
+
} catch (error) {
|
|
349
|
+
fail(error instanceof Error ? error.message : String(error))
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
const { TOKEN_OPS } = await loadModule('tokens/ops.mjs')
|
|
353
|
+
if (TOKEN_OPS.includes(sub)) {
|
|
354
|
+
const { runTokenOpCli } = await loadModule('cli/tokenOps.mjs')
|
|
355
|
+
process.exit(await runTokenOpCli({ root, op: sub, argv: process.argv.slice(4) }))
|
|
356
|
+
}
|
|
357
|
+
fail(
|
|
358
|
+
`unknown tokens subcommand: ${sub ?? '(missing)'} (expected build, check, extract, ${TOKEN_OPS.join(', ')})`,
|
|
359
|
+
)
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
if (command === 'component') {
|
|
363
|
+
try {
|
|
364
|
+
const { runComponentCommand } = await loadModule('cli/component.mjs')
|
|
365
|
+
console.log(await runComponentCommand({ root, argv: process.argv.slice(3) }))
|
|
366
|
+
process.exit(0)
|
|
367
|
+
} catch (error) {
|
|
368
|
+
fail(error instanceof Error ? error.message : String(error))
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
if (command === 'proposal') {
|
|
373
|
+
try {
|
|
374
|
+
const { runProposalCommand } = await loadModule('cli/component.mjs')
|
|
375
|
+
console.log(runProposalCommand({ root, argv: process.argv.slice(3) }))
|
|
376
|
+
process.exit(0)
|
|
377
|
+
} catch (error) {
|
|
378
|
+
fail(error instanceof Error ? error.message : String(error))
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
if (command === 'propose' && arg === 'component') {
|
|
383
|
+
try {
|
|
384
|
+
const { proposeComponent } = await loadModule('cli/component.mjs')
|
|
385
|
+
console.log(await proposeComponent({ root, argv: process.argv.slice(4) }))
|
|
386
|
+
process.exit(0)
|
|
387
|
+
} catch (error) {
|
|
388
|
+
fail(error instanceof Error ? error.message : String(error))
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
if (command === 'consolidate') {
|
|
393
|
+
const { CONSOLIDATE_COMMANDS } = await loadModule('tokens/consolidate/index.mjs')
|
|
394
|
+
if (!CONSOLIDATE_COMMANDS.includes(arg)) {
|
|
395
|
+
fail(`unknown consolidate command: ${arg ?? '(missing)'} (expected ${CONSOLIDATE_COMMANDS.join(', ')})`)
|
|
396
|
+
}
|
|
397
|
+
const { runConsolidateCli } = await loadModule('cli/consolidate.mjs')
|
|
398
|
+
process.exit(await runConsolidateCli({ root, command: arg, argv: process.argv.slice(4) }))
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
if (command === 'propose') {
|
|
402
|
+
if (arg !== 'token') {
|
|
403
|
+
fail(`unknown propose target: ${arg ?? '(missing)'} (expected "token" or "component")`)
|
|
404
|
+
}
|
|
405
|
+
try {
|
|
406
|
+
const { proposeToken } = await loadModule('cli/propose.mjs')
|
|
407
|
+
const { item, reviewPath } = await proposeToken({ root, argv: process.argv.slice(4) })
|
|
408
|
+
const rel = path.relative(root, reviewPath).split(path.sep).join('/')
|
|
409
|
+
console.log(
|
|
410
|
+
`Proposed ${item.target.token} (${item.tokenTier} · ${item.tokenAction} -> ${item.to}) in ${rel}`,
|
|
411
|
+
)
|
|
412
|
+
process.exit(0)
|
|
413
|
+
} catch (error) {
|
|
414
|
+
fail(error instanceof Error ? error.message : String(error))
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
if (command === 'usage') {
|
|
419
|
+
// Tokens are CSS names (`--ds-accent`) or paths, so `--hardcoded` is the only option.
|
|
420
|
+
const rest = process.argv.slice(3)
|
|
421
|
+
const hardcodedAt = rest.indexOf('--hardcoded')
|
|
422
|
+
try {
|
|
423
|
+
const { buildUsageIndex } = await loadModule('tokens/usage.mjs')
|
|
424
|
+
const index = await buildUsageIndex({ root })
|
|
425
|
+
if (hardcodedAt !== -1) {
|
|
426
|
+
const scope = rest.filter((item, i) => i !== hardcodedAt)[0]
|
|
427
|
+
console.log(JSON.stringify(index.hardcoded(scope), null, 2))
|
|
428
|
+
process.exit(0)
|
|
429
|
+
}
|
|
430
|
+
if (!arg) {
|
|
431
|
+
console.log(JSON.stringify(index.allTokens(), null, 2))
|
|
432
|
+
process.exit(0)
|
|
433
|
+
}
|
|
434
|
+
const report = index.tokenUsage(arg)
|
|
435
|
+
if (!report) fail(`unknown token: ${arg}`)
|
|
436
|
+
console.log(JSON.stringify(report, null, 2))
|
|
437
|
+
process.exit(0)
|
|
438
|
+
} catch (error) {
|
|
439
|
+
fail(error instanceof Error ? error.message : String(error))
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
if (command === 'health') {
|
|
444
|
+
try {
|
|
445
|
+
const { healthReport } = await loadModule('tokens/report.mjs')
|
|
446
|
+
const report = await healthReport({ root })
|
|
447
|
+
console.log(JSON.stringify(report, null, 2))
|
|
448
|
+
process.exit(report.ok ? 0 : 1)
|
|
449
|
+
} catch (error) {
|
|
450
|
+
fail(error instanceof Error ? error.message : String(error))
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
if (command === 'verify') {
|
|
455
|
+
try {
|
|
456
|
+
const { parseFlags } = await loadModule('cli/snapshot.mjs')
|
|
457
|
+
const { flags, positionals } = parseFlags(process.argv.slice(3), ['dry-run', 'item', 'snapshots', 'url', 'config'])
|
|
458
|
+
const { verifyReviews } = await loadModule('tokens/report.mjs')
|
|
459
|
+
const results = await verifyReviews({
|
|
460
|
+
root,
|
|
461
|
+
designs: positionals,
|
|
462
|
+
dryRun: Boolean(flags['dry-run']),
|
|
463
|
+
items: flags.item.length ? flags.item : undefined,
|
|
464
|
+
snapshots: Boolean(flags.snapshots),
|
|
465
|
+
url: flags.url,
|
|
466
|
+
configFile: flags.config ? path.resolve(root, flags.config) : undefined,
|
|
467
|
+
})
|
|
468
|
+
console.log(JSON.stringify(results, null, 2))
|
|
469
|
+
const snapshotError = results.find((result) => result.snapshotError)?.snapshotError
|
|
470
|
+
if (snapshotError) fail(snapshotError)
|
|
471
|
+
process.exit(0)
|
|
472
|
+
} catch (error) {
|
|
473
|
+
fail(error instanceof Error ? error.message : String(error))
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
if (command === 'snapshot') {
|
|
478
|
+
try {
|
|
479
|
+
const { runSnapshotCommand } = await loadModule('cli/snapshot.mjs')
|
|
480
|
+
console.log(JSON.stringify(await runSnapshotCommand({ root, argv: process.argv.slice(3) }), null, 2))
|
|
481
|
+
process.exit(0)
|
|
482
|
+
} catch (error) {
|
|
483
|
+
fail(error instanceof Error ? error.message : String(error))
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
if (command === 'reply') {
|
|
488
|
+
try {
|
|
489
|
+
const { replyReviewItem } = await loadModule('cli/reviewOps.mjs')
|
|
490
|
+
const { item, reminder } = replyReviewItem({ root, argv: process.argv.slice(3) })
|
|
491
|
+
console.log(`Replied to ${item.id} (${item.status})`)
|
|
492
|
+
if (reminder) console.log(reminder)
|
|
493
|
+
process.exit(0)
|
|
494
|
+
} catch (error) {
|
|
495
|
+
fail(error instanceof Error ? error.message : String(error))
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
if (command === 'status') {
|
|
500
|
+
try {
|
|
501
|
+
const { updateReviewItemStatus } = await loadModule('cli/reviewOps.mjs')
|
|
502
|
+
const { item, reminder } = updateReviewItemStatus({ root, argv: process.argv.slice(3) })
|
|
503
|
+
console.log(`Updated ${item.id} -> ${item.status}`)
|
|
504
|
+
if (reminder) console.log(reminder)
|
|
505
|
+
process.exit(0)
|
|
506
|
+
} catch (error) {
|
|
507
|
+
fail(error instanceof Error ? error.message : String(error))
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
if (command === 'list') {
|
|
512
|
+
const { isUnreviewedProposal } = await loadModule('shared/prompt.mjs')
|
|
513
|
+
const files = reviewFiles()
|
|
514
|
+
if (!files.length) {
|
|
515
|
+
console.log('No review ledgers.')
|
|
516
|
+
process.exit(0)
|
|
517
|
+
}
|
|
518
|
+
for (const item of files) {
|
|
519
|
+
const review = readJson(item.file)
|
|
520
|
+
const items = review?.items ?? []
|
|
521
|
+
const awaitingApproval = items.filter(isUnreviewedProposal).length
|
|
522
|
+
const approvalSuffix = awaitingApproval ? `, ${awaitingApproval} awaiting approval` : ''
|
|
523
|
+
console.log(
|
|
524
|
+
`${item.design}: ${pending(items).length} pending — ${countBy(items, 'open')} open, ${countBy(items, 'in_progress')} in progress, ${countBy(items, 'resolved')} resolved, ${countBy(items, 'archived')} archived${approvalSuffix}`,
|
|
525
|
+
)
|
|
526
|
+
}
|
|
527
|
+
process.exit(0)
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
if (command === 'show') {
|
|
531
|
+
if (!arg) fail('show requires a design id')
|
|
532
|
+
const file = path.join(designRoot, arg, 'review.json')
|
|
533
|
+
const review = readJson(file)
|
|
534
|
+
if (!review) fail(`no review ledger for ${arg}`)
|
|
535
|
+
console.log(JSON.stringify(review, null, 2))
|
|
536
|
+
process.exit(0)
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
if (command === 'clear') {
|
|
540
|
+
if (!arg) fail('clear requires a design id')
|
|
541
|
+
try {
|
|
542
|
+
const { mutateReview } = await loadModule('shared/reviewStore.mjs')
|
|
543
|
+
mutateReview(root, arg, (review) => ({
|
|
544
|
+
...review,
|
|
545
|
+
items: review.items.filter((item) => item.status === 'archived' || item.kind === 'comment'),
|
|
546
|
+
}))
|
|
547
|
+
} catch (error) {
|
|
548
|
+
fail(error instanceof Error ? error.message : String(error))
|
|
549
|
+
}
|
|
550
|
+
console.log(`cleared pending non-comment items for ${arg}`)
|
|
551
|
+
process.exit(0)
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
if (command === 'prompt') {
|
|
555
|
+
const { agentPromptFor } = await loadModule('cli/prompt.mjs')
|
|
556
|
+
try {
|
|
557
|
+
console.log(await agentPromptFor({ root, design: arg }))
|
|
558
|
+
} catch (error) {
|
|
559
|
+
fail(error instanceof Error ? error.message : String(error))
|
|
560
|
+
}
|
|
561
|
+
process.exit(0)
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
if (command === 'check') {
|
|
565
|
+
const files = reviewFiles()
|
|
566
|
+
let failed = false
|
|
567
|
+
for (const item of files) {
|
|
568
|
+
const review = readJson(item.file)
|
|
569
|
+
if (!review || review.version !== 1 || !Array.isArray(review.items)) {
|
|
570
|
+
console.error(`INVALID ${item.design}: review.json must contain version 1 and items[]`)
|
|
571
|
+
failed = true
|
|
572
|
+
continue
|
|
573
|
+
}
|
|
574
|
+
console.log(`OK ${item.design}: ${review.items.length} item(s), ${(review.batches ?? []).length} batch(es)`)
|
|
575
|
+
}
|
|
576
|
+
const { misplacedSketches } = await loadModule('cli/sketches.mjs')
|
|
577
|
+
const { MISPLACED_SKETCH_HINT } = await loadModule('shared/sketches.mjs')
|
|
578
|
+
for (const file of misplacedSketches(root)) console.warn(`Warning: ${file} exports a React component outside sketches/. ${MISPLACED_SKETCH_HINT}.`)
|
|
579
|
+
if (failed) process.exit(1)
|
|
580
|
+
if (!files.length) console.log('No review ledgers.')
|
|
581
|
+
process.exit(0)
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
fail(`unknown command: ${command}`)
|
|
585
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare class AgentError extends Error {
|
|
2
|
+
code: string
|
|
3
|
+
status: number
|
|
4
|
+
constructor(code: string, message: string, status?: number)
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export type AgentHostEvent =
|
|
8
|
+
| { type: 'state'; state: Record<string, unknown> }
|
|
9
|
+
| { type: 'record'; conversation: number; record: unknown }
|
|
10
|
+
| { type: 'reset'; conversation: number }
|
|
11
|
+
|
|
12
|
+
export type AgentHost = {
|
|
13
|
+
ready: Promise<unknown>
|
|
14
|
+
state: () => Record<string, unknown> & { conversation: number }
|
|
15
|
+
records: () => unknown[]
|
|
16
|
+
view: () => unknown
|
|
17
|
+
subscribe: (listener: (event: AgentHostEvent) => void) => () => void
|
|
18
|
+
detect: () => Promise<unknown>
|
|
19
|
+
send: (input: { text?: unknown; handoff?: unknown; context?: unknown }) => Promise<unknown>
|
|
20
|
+
stop: () => Promise<unknown>
|
|
21
|
+
newConversation: () => Promise<unknown>
|
|
22
|
+
select: (input: { agent?: string; model?: string | null; effort?: string | null }) => Promise<unknown>
|
|
23
|
+
close: () => Promise<void>
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export declare function slimRecord<T>(record: T): T
|
|
27
|
+
export declare function createAgentHost(options: {
|
|
28
|
+
root: string
|
|
29
|
+
board?: string
|
|
30
|
+
app?: string
|
|
31
|
+
env?: Record<string, string | undefined>
|
|
32
|
+
loadRuntimes?: (input: { env: Record<string, string | undefined>; root: string }) => Promise<{ entries: unknown[]; problems?: string[] }>
|
|
33
|
+
log?: (message: string) => void
|
|
34
|
+
}): AgentHost
|